home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1995 June
/
MacFormat 25.iso
/
Shareware City
/
Developers
/
ICProgKit1.0
/
Examples
/
CExample.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-12
|
2KB
|
69 lines
#include <stdio.h>
#include <Types.h>
#include <Files.h>
#ifndef THINK_C
#include <Strings.h>
#endif
#include <ICTypes.h>
#include <ICAPI.h>
#include <ICKeys.h>
void DumpPrefs(void);
ICInstance inst;
main () {
ICError err;
ICDirSpecArray folder_spec;
Str255 email_address;
long attr;
long size;
long seed;
err = ICStart(&inst, 'CREA'); /* tell it your application creator */
printf("ICStart: %ld\n", err);
folder_spec[0].vRefNum = -1; /* search for prefs in root of the system */
folder_spec[0].dirID = 2; /* volume, obviously you'd use other things */
err = ICFindConfigFile(inst, 1, (ICDirSpecArrayPtr) &folder_spec);
printf("ICFindConfigFile: %ld\n", err);
err = ICBegin(inst, icReadWritePerm);
printf("ICBegin: %ld\n", err);
size = sizeof(email_address);
err = ICGetPref(inst, "\pEmail", &attr, (Ptr) email_address, &size);
printf("ICGetPref: %ld\n", err);
p2cstr(email_address);
printf("Your Email address is %s\n", email_address);
DumpPrefs();
err = ICEnd(inst);
printf("ICEnd: %ld\n", err);
err = ICGetSeed(inst, &seed);
printf("ICGetSeed: %ld = %ld\n", err, seed);
/* now monitor this seed to see if any preferences have changed */
err = ICStop(inst);
printf("ICStop: %ld\n", err);
}
void DumpPrefs()
{
ICError err;
long count;
long i;
Str255 key;
err = ICCountPref(inst, &count);
printf("ICCountPref: %ld\n", err);
for (i = 1; i <= count; i++) {
err = ICGetIndPref(inst, i, key);
p2cstr(key);
printf(" ICGetIndPref: %ld - %s\n", err, &key);
};
}